package zhuyun.code.launcheractivity.utils

import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions

/**
 * @author: Administrator
 * @date: 2021/11/21
 */
object GlideUtil {
    fun displayAppointImage(url:String,imageView:ImageView){
        var urlTemp:String?=null
        if(url.contains("aliyuncs.com")||url.contains("inet8888.com")){
            urlTemp = url + "_320x320"
        }
        if(imageView.context!=null){
            Glide.with(imageView.context).load(urlTemp).into(imageView)
        }
    }

    fun displayEspImage(url:String,imageView:ImageView,defaultImage:Int){
        if(imageView.context!=null){
            Glide.with(imageView.context).load(url)
                .apply(RequestOptions().dontAnimate()
                    .placeholder(defaultImage).error(defaultImage))
                .into(imageView)
        }
    }

}